package com.zlc.common.core.sys.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zlc.common.common.service.BaseServiceImpl;
import com.zlc.common.core.sys.mapper.MayanPlatDicMapper;
import com.zlc.common.core.sys.model.entity.MayanPlatDic;
import com.zlc.common.core.sys.model.vo.MayanPlatDicVo;
import com.zlc.common.core.sys.service.MayanPlatDicService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author  zl
 * @date 2023-07-20 
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class MayanPlatDicServiceImpl extends BaseServiceImpl<MayanPlatDicMapper, MayanPlatDic, MayanPlatDicVo> implements MayanPlatDicService{

    @Override
    public MayanPlatDicVo getByCode(String code) {
        LambdaQueryWrapper<MayanPlatDic> wrapper = wrapper();
        wrapper.eq(MayanPlatDic::getCode,code);
        return queryOne(wrapper);
    }

    @Override
    public List<MayanPlatDicVo> getByParentCode(String parentCode) {
        LambdaQueryWrapper<MayanPlatDic> wrapper = wrapper();
        wrapper.eq(MayanPlatDic::getParentCode,parentCode);
        return queryVoList(wrapper);
    }
}
